package cn.cloud.butler.webapi.controller;

import cn.cloud.butler.webapi.domain.ResponseEntity;
import cn.cloud.butler.webapi.domain.ScrewTimeEntity;
import cn.cloud.butler.webapi.logger.WaLogger;
import cn.cloud.butler.webapi.service.MachineScrewService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * author: daichaoren
 * time: 2019-01-07
 * description: 机床丝杠接口
 */
@RestController
@EnableAutoConfiguration
@RequestMapping("/HncWeb")
public class MachineScrewController {
    @Autowired
    MachineScrewService machineScrewService;
    //接口65
    //机床丝杠经过某段距离的次数
    //http://10.10.56.52:8080/HncWeb/SelScrewTime.action?macsn=20CF1B9BDFF3733<br>
    @RequestMapping(method = RequestMethod.GET,value = "/SelScrewTime.action")
    public ResponseEntity SelScrewTime(String macsn){
        ResponseEntity response = new ResponseEntity();
        try{
            List<ScrewTimeEntity> proList =  machineScrewService.SelScrewTime(macsn);
            response.setMsgDesc("查询成功");
            response.setMsgCode(0);
            response.setData(proList);
        }catch (Exception e){
            response.setMsgCode(1);
            response.setMsgDesc(e.toString());
            WaLogger.logger.warn(e.toString());
        }
        return  response;
    }

}
